void main() { 
	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
	vec3 N = normalize(gl_NormalMatrix * gl_Normal);
	vec4 V = gl_ModelViewMatrix * gl_Vertex;
	vec3 L = normalize(gl_LightSource[0].position.xyz - V.xyz);
	vec3 H = normalize(L + vec3(0.0, 0.0, 1.0));

	const float specExp = 128.0;

	float NdotL = max(0.0, dot(N, L));
	vec4 diffuse = gl_Color * vec4(NdotL);

	// specular lighting
	float NdotH = max(0.0, dot(N, H));
	vec4 spec = vec4(0.0);

	if(NdotL > 0.0) {
		spec = vec4(pow(NdotH, specExp));
	}

	gl_FrontColor = diffuse + spec;
}
